package com.magicmovie.service;

import com.magicmovie.entity.Order;
import com.magicmovie.utils.QueryFilters;
import com.magicmovie.utils.data.PageModel;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public interface OrderService {

    @RequestMapping(value = "/order/findByUidAndMovieId",method = RequestMethod.GET)
    Order findByUidAndMovieId(@RequestParam("uid") Integer uid, @RequestParam("movieId") Integer movieId);

    @RequestMapping(value = "/order/findByCustomer",method = RequestMethod.GET)
    List<Map<String, Object>> findByCustomer(@RequestParam("customerId") Integer customerId);

    @RequestMapping(value = "/order/createOrder",method = RequestMethod.GET)
    String crateOrder(@RequestParam("price") Float price,@RequestParam("payType") String payType,@RequestParam("site") String site,@RequestParam("customerId") Integer customerId,@RequestParam("movieId") Integer movieId);

    @RequestMapping(value = "/order/findByOrderNum",method = RequestMethod.GET)
    Order findByOrderNum(@RequestParam("orderNum") String orderNum);

    @RequestMapping(value = "/order/update",method = RequestMethod.POST)
    void update(@RequestBody Order order);

    @RequestMapping(value = "/order/payByBalance",method = RequestMethod.POST)
    void payByBalance(@RequestBody Order order);

    @RequestMapping(value = "/order/updateOrderStatus",method = RequestMethod.POST)
    void updateOrderStatus(@RequestBody Order order);

    @RequestMapping(value = "/order/getByFilter",method = RequestMethod.POST)
    PageModel getByFilter(@RequestBody QueryFilters filters);

    /**
     * 域名列表
     *
     */
    @RequestMapping(value = "/order/getSitesList",method = RequestMethod.POST)
    List<Map<String,Object>> getSitesList(@RequestBody QueryFilters filters);

    /**
     * 域名详情
     */
    @RequestMapping(value = "/order/siteDetails",method = RequestMethod.POST)
    List<Map<String, Object>> siteDetails(@RequestBody QueryFilters filters);

    /**
     * 畅销榜 前10
     * @return
     */
    @GetMapping("/order/bestSellingList")
    List<Map<String,Object>> bestSellingList();

    /**
     * 付费榜用户 前10
     * @return
     */
    @GetMapping("/order/mostPaidUserList")
    List<Map<String,Object>> mostPaidUser();

    /**
     * 根据类型统计
     * 1： 统计总付费用户 2:总订单数 3：订单总价 4：总域名数
     * @param type
     * @return
     */
    @GetMapping("/order/statisticsByType")
    Integer statisticsByType(@RequestParam("type") Integer type);


    @RequestMapping(value = "/order/getMoneyByFilter",method = RequestMethod.POST)
    Double getMoneyByFilter(@RequestBody QueryFilters filters);
}
